<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html dir="ltr" xmlns="http://www.w3.org/1999/xhtml">
<%@include file="/WEB-INF/taglibs/common/taglibs.jsp"%>
<head>
<title><spring:message code="admin.faqupdateanswer.title" /></title>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type" />
<link rel="stylesheet" href="<c:url value="/css/styles.css"/>" />
<script src="<c:url value="/javascripts/common.js"/>"></script>

</head>

<body>
<%@include file="../top_menu.jsp"%>
<table width="100%">
	<tr>
		<td><c:import url="/WEB-INF/jsp/admin/faq/faq_menu.jsp" />
		</td>
	</tr>
</table>

<div class="contentArea">
<table border=0 cellpadding=0 cellspacing=0 width=70% align="center">
	<tr>
		<td valign="top"></td>
		<td valign="top">
		<table border="0" cellpadding="5" cellspacing="5" width="100%" align="center">

			<tr>
				<td colspan="2">
				<form:form commandName="answerUpdate" method="post" onsubmit="return validateForm()">
					<input type="hidden" id="questionId" name="questionId" value="${question.id}" />
					<input type="hidden" id="answerId" name="answerId" value="${answerUpdate.id}" />
					<table width=70% class="formTable" cellpadding="5" cellspacing="5">
					
						<tr>
							<td colspan="2" align="center"><h3><spring:message code="admin.faqupdateanswer.label.updateanswer" /></h3></td>
						</tr>
										 
						<tr>
							<td><spring:message code="admin.faqupdateanswer.label.questionid" /></td>
							<td>${question.id}</td>
						</tr>
						<tr>
							<td><spring:message code="admin.faqupdateanswer.label.email" /></td>
							<td>${question.email}</td>
						</tr>
						<tr>
							<td><spring:message code="admin.faqupdateanswer.label.firstname" /></td>
							<td>${question.firstName}</td>
						</tr>						
						<tr>
							<td><spring:message code="admin.faqupdateanswer.label.lastname" /></td>
							<td>${question.lastName}</td>
						</tr>
						<tr>
							<td><b><spring:message code="admin.faqupdateanswer.label.question" /></b></td>
							<td>${question.question}</td>
						</tr>
						<tr>
							<td><spring:message code="admin.faqupdateanswer.label.category" /></td>
							<td>${question.category.name}</td>
						</tr>						
						<tr>
							<td><spring:message code="admin.faqupdateanswer.label.ordername" /></td>
							<td>${question.orderNumber}</td>
						</tr>						
						<tr>
							<td><b><spring:message code="admin.faqupdateanswer.label.confidential" /></b></td>
							<td>${question.confidentialLabel}</td>
						</tr>
						<tr>
							<td><spring:message code="admin.faqupdateanswer.label.tag" /></td>
							<td>${question.tag}</td>
						</tr>
						<tr>
							<td><spring:message code="admin.faqupdateanswer.label.cretedat" /></td>
							<td>${question.createdDatetime}</td>
						</tr>	
													
						<tr>
							<td colspan="2"><hr /></td>
						</tr>
							
						<tr>
							<td colspan="2"><spring:message code="admin.faqupdateanswer.label.reply" /><font color=red>*</font></td>
						</tr>
																		
						<tr>							
							<td colspan="2"><form:textarea path="answer" cols="70" rows="20"/>
							</td>
						</tr>
						
						<tr>
							<td><spring:message code="admin.faqupdateanswer.label.tagforanswer" /></td>
							<td><form:input path="tag" size="50"/>
						</tr>						
																																							
						<tr>							
							<td colspan="2">
								<spring:message code="admin.faqupdateanswer.label.rankthisquestion" />: &nbsp;&nbsp;
								<select id="topRank" name="topRank">
									<option value="1" <c:if test="${question.topRank == 1}">selected="selected"</c:if>>1</option>
									<option value="2" <c:if test="${question.topRank == 2}">selected="selected"</c:if>>2</option>
									<option value="3" <c:if test="${question.topRank == 3}">selected="selected"</c:if>>3</option>
									<option value="4" <c:if test="${question.topRank == 4}">selected="selected"</c:if>>4</option>
									<option value="5" <c:if test="${question.topRank == 5}">selected="selected"</c:if>>5</option>
									<option value="6" <c:if test="${question.topRank == 6}">selected="selected"</c:if>>6</option>
									<option value="7" <c:if test="${question.topRank == 7}">selected="selected"</c:if>>7</option>
									<option value="8" <c:if test="${question.topRank == 8}">selected="selected"</c:if>>8</option>
									<option value="9" <c:if test="${question.topRank == 9}">selected="selected"</c:if>>9</option>
									<option value="10" <c:if test="${question.topRank == 10}">selected="selected"</c:if>>10</option>
								</select>
							</td>
						</tr>
																		
						<tr>
							<td colspan="2">&nbsp;</td>
						</tr>

						<tr>
							<td colspan="2" align="center"><input type="submit" class='ui-button ui-state-default ui-corner-all' value="<spring:message code="admin.faqupdateanswer.button.save" />" />
								&nbsp;&nbsp;&nbsp;&nbsp;
								 <input type="button" class='ui-button ui-state-default ui-corner-all'
								value="<spring:message code="admin.faqupdateanswer.button.cancel" />" onclick="location.href='faq_question.htm'" /></td>
						</tr>
					</table>
				</form:form></td>
			</tr>
		</table>
		</td>
	</tr>

	<script language="javascript">
		function validateForm() {
			var isValid = true;
			var answerField = document.getElementById("answer");
			var tagField = document.getElementById("tag");
			isValid = validate_required(answerField, 'Please enter content');
			
			if (isValid) {
				isValid = validate_length(answerField, 'Reply', 3000);
			}
			
			if (isValid) {
				isValid = validate_length(tagField, 'Tag', 255);
			}			
			
			return isValid;
		}
	</script>

</table>
</div>

<%@include file="/WEB-INF/jsp/include/footer.jsp"%>
</body>
</html>